package com.hevery.web.controller;

import com.hevery.dto.User;
import com.hevery.dto.UserQueryCondition;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: ${description}
 * @author: hongyu.zhang
 * @create: 2018-04-07
 **/
@RestController
public class UserController {
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public List<User> query(UserQueryCondition userQueryCondition,@PageableDefault(page = 2,size = 17,sort = "age,desc") Pageable pageable){
        List<User> users = new ArrayList<>();
        System.out.println(pageable.getPageSize());
        System.out.println(pageable.getPageNumber());
        System.out.println(pageable.getSort());
        users.add(new User());
        users.add(new User());
        users.add(new User());
        return users;
    }
}